from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers


class PermissionSerializer(serializers.ModelSerializer):
    """
    权限序列化器
    """
    class Meta:
        model = Permission
        # 两种均可
        fields = ["id","name","codename","content_type"]
        # fields = "__all__"

class ContentTypeSerialzier(serializers.ModelSerializer):
    """
    权限类型序列化器
    """
    class Meta:
        model = ContentType
        fields = ["id","name"]